<!-- src/views/video/article/index.vue -->
<template>
  <div class="article-container">
    <!-- 搜索区域 -->
    <el-card class="search-card">
      <el-form :model="queryParams" ref="queryForm" :inline="true">
        <el-form-item label="标题" prop="title">
          <el-input v-model="queryParams.title" placeholder="请输入文章标题" clearable />
        </el-form-item>
        <el-form-item label="分类">
          <el-cascader
              v-model="queryParams.categoryId"
              :options="categoryOptions"
              :props="{
          checkStrictly: true,
          label: 'name',
          value: 'id',
          emitPath: false
        }"
              placeholder="选择分类"
              clearable
              style="width: 240px;"
          >
            <template #default="{ node, data }">
              <span>{{ data.name }}</span>
              <span v-if="!node.isLeaf"> ({{ data.children?.length || 0 }}) </span>
            </template>
          </el-cascader>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleQuery">
            <el-icon><Search /></el-icon>查询
          </el-button>
          <el-button @click="resetQuery">
            <el-icon><Refresh /></el-icon>重置
          </el-button>
        </el-form-item>
      </el-form>
    </el-card>

    <!-- 操作按钮区域 -->
    <el-card class="table-card">
      <template #header>
        <div class="card-header">
          <div class="left">
            <el-button type="primary" :disabled="!selectedArticles.length" @click="handleBatchEdit">
              批量编辑
            </el-button>
            <el-button type="danger" :disabled="!selectedArticles.length" @click="handleBatchDelete">
              批量删除
            </el-button>
            <el-button type="success" :disabled="!selectedArticles.length" @click="handleGenerateVideo">
              批量生成视频
            </el-button>
            <el-tag v-if="selectedArticles.length" type="info">
              已选择 {{ selectedArticles.length }} 项
            </el-tag>
          </div>
          <div class="right">
            <el-button type="primary" @click="handleImport">
              <el-icon><Upload /></el-icon>导入文章
            </el-button>
          </div>
        </div>
      </template>

      <!-- 表格区域 -->
      <el-table
          v-loading="loading || defaultLoading || generatingVideo"
          :data="articleList"
          @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column label="标题" prop="title" :show-overflow-tooltip="true" />
        <el-table-column label="描述" prop="description" :show-overflow-tooltip="true" />
<!--        <el-table-column label="分类" prop="categoryName" :show-overflow-tooltip="true" />-->
        <el-table-column label="分类" prop="categoryName" :show-overflow-tooltip="true">
          <template #default="{ row }">
            <span>{{ row.categoryPath || '-' }}</span>
          </template>
        </el-table-column>
        <el-table-column label="视频状态" prop="status" width="100">
          <template #default="scope">
            <el-tag :type="getVideoStatusType(scope.row.status)" v-if="scope.row.status">
              {{ scope.row.status }}
            </el-tag>
            <el-tag type="info" v-else>未生成</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="导入时间" prop="importTimestamp" width="160" />
        <el-table-column label="操作" width="180" fixed="right">
          <template #default="scope">
            <el-button-group>
              <el-tooltip content="查看详情" placement="top">
                <el-button
                    link
                    type="primary"
                    :icon="View"
                    @click="handleView(scope.row)"
                />
              </el-tooltip>
              <el-tooltip content="编辑" placement="top">
                <el-button
                    link
                    type="primary"
                    :icon="Edit"
                    @click="handleEdit([scope.row])"
                />
              </el-tooltip>
              <el-tooltip content="生成视频" placement="top" v-if="canGenerate(scope.row)">
                <el-button
                    link
                    type="success"
                    :icon="VideoCamera"
                    @click="handleGenerateSingle(scope.row)"
                />
              </el-tooltip>
              <el-tooltip content="删除" placement="top">
                <el-button
                    link
                    type="danger"
                    :icon="Delete"
                    @click="handleDelete(scope.row)"
                />
              </el-tooltip>
            </el-button-group>
          </template>
        </el-table-column>
      </el-table>

      <el-empty
          v-if="!loading && articleList.length === 0"
          description="暂无数据"
      >
        <el-button type="primary" @click="handleImport">立即导入</el-button>
      </el-empty>

      <!-- 分页 -->
      <div class="pagination">
        <el-pagination
            v-model:current-page="queryParams.pageNum"
            v-model:page-size="queryParams.pageSize"
            :total="total"
            :page-sizes="[10, 20, 50, 100]"
            layout="total, sizes, prev, pager, next, jumper"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
        />
      </div>
    </el-card>

    <!-- 文章详情弹窗 -->
    <el-dialog
        v-model="detailDialog.visible"
        title="文章详情"
        width="1200px"
        top="5vh"
        :close-on-click-modal="false"
    >
      <el-descriptions :column="1" border>
        <el-descriptions-item label="文章标题">
          <el-input type="textarea" v-model="detailDialog.form.title" disabled />
        </el-descriptions-item>
        <el-descriptions-item label="文章描述">
          <el-input type="textarea" v-model="detailDialog.form.description" disabled />
        </el-descriptions-item>
<!--        <el-descriptions-item label="原文链接">-->
<!--          <el-link :href="detailDialog.form.url" target="_blank" type="primary">-->
<!--            {{ detailDialog.form.url }}-->
<!--          </el-link>-->
<!--        </el-descriptions-item>-->
        <el-descriptions-item label="导入时间">
          {{ detailDialog.form.importTimestamp }}
        </el-descriptions-item>
        <el-descriptions-item label="视频状态">
          <el-tag :type="getVideoStatusType(detailDialog.form.status)">
            {{ detailDialog.form.status }}
          </el-tag>
        </el-descriptions-item>
        <el-descriptions-item v-if="detailDialog.form.videoUrl" label="视频链接">
          <el-input type="textarea" v-model="detailDialog.form.videoUrl" disabled>
            {{ detailDialog.form.videoUrl }}
          </el-input>
        </el-descriptions-item>
      </el-descriptions>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="detailDialog.visible = false">关闭</el-button>
          <el-button
              type="primary"
              @click="handleGenerateSingle(detailDialog.form)"
              v-if="canGenerate(detailDialog.form)"
          >生成视频</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 导入弹窗 -->
    <el-dialog
        v-model="importDialog.visible"
        title="导入文章"
        width="500px"
        :close-on-click-modal="false"
    >
      <div class="import-header">
        <el-button type="primary" link @click="downloadTemplate">
          <el-icon><Download /></el-icon>下载导入模板
        </el-button>
      </div>

      <!-- 添加分类选择 -->
      <el-form :model="importForm" label-width="80px" class="import-form">
        <el-form-item label="选择分类" required>
          <el-cascader
              v-model="importForm.categoryId"
              :options="categoryOptions"
              :props="{
            checkStrictly: true,
            label: 'name',
            value: 'id',
            emitPath: false
          }"
              placeholder="请选择分类"
              clearable
              class="category-select"
          />
          <el-button
              type="primary"
              link
              @click="showCategoryDialog"
              class="add-category-btn"
          >
            <el-icon><Plus /></el-icon>添加分类
          </el-button>
        </el-form-item>
      </el-form>

      <div class="upload-container">
        <el-upload
            class="upload-drop"
            drag
            action="#"
            accept=".xlsx,.xls"
            :auto-upload="false"
            :show-file-list="false"
            :on-change="handleFileChange"
        >
          <el-icon class="el-icon--upload"><upload-filled /></el-icon>
          <div class="el-upload__text">
            将文件拖到此处，或<em>点击上传</em>
          </div>
          <template #tip>
            <div class="el-upload__tip">
              支持 Excel 文件（.xlsx, .xls）
            </div>
          </template>
        </el-upload>

        <!-- 预览区域 -->
        <div v-if="importDialog.file" class="file-info">
          <div class="file-name">
            <el-icon><Document /></el-icon>
            <span>{{ importDialog.file.name }}</span>
            <el-button link type="danger" @click="handleRemoveFile">
              <el-icon><Delete /></el-icon>
            </el-button>
          </div>
        </div>
      </div>

      <template #footer>
        <div class="dialog-footer">
          <el-button @click="importDialog.visible = false">取消</el-button>
          <el-button
              type="primary"
              @click="submitImport"
              :loading="importDialog.loading"
              :disabled="!importDialog.file || !importForm.categoryId"
          >
            导入
          </el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 添加分类弹窗 -->
    <el-dialog
        v-model="categoryDialog.visible"
        :title="categoryDialog.isEdit ? '编辑分类' : '添加分类'"
        width="500px"
        append-to-body
    >
      <el-form
          :model="categoryDialog.form"
          :rules="categoryRules"
          ref="categoryFormRef"
          label-width="100px"
      >
        <el-form-item label="上级分类">
          <el-cascader
              v-model="categoryDialog.form.parentId"
              :options="categoryOptions"
              :props="{
            checkStrictly: true,
            label: 'name',
            value: 'id',
            emitPath: false
          }"
              placeholder="请选择上级分类"
              clearable
              class="category-select"
          />
        </el-form-item>
        <el-form-item label="分类名称" prop="name">
          <el-input v-model="categoryDialog.form.name" placeholder="请输入分类名称" />
        </el-form-item>
        <el-form-item label="分类编码" prop="code">
          <el-input v-model="categoryDialog.form.code" placeholder="请输入分类编码" />
        </el-form-item>
        <el-form-item label="排序" prop="sort">
          <el-input-number v-model="categoryDialog.form.sort" :min="0" :max="999" />
        </el-form-item>
        <el-form-item label="描述">
          <el-input
              v-model="categoryDialog.form.description"
              type="textarea"
              placeholder="请输入描述"
          />
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="categoryDialog.visible = false">取消</el-button>
          <el-button type="primary" @click="submitCategory">确定</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 生成视频配置弹窗 -->
    <VideoConfigSelect
        v-model:visible="generateDialog.visible"
        :title="generateDialog.articles.length > 1 ? '批量生成视频配置' : '生成视频配置'"
        :default-config="defaultConfig"
        :default-loading="defaultLoading"
        :submitting="submitting"
        @confirm="handleGenerateConfirm"
        @close="handleGenerateClose"
    />

    <ArticleEditDialog
        v-model:visible="editDialogVisible"
        :articles="editingArticles"
        @save="handleEditSave"
    />
  </div>
</template>

<script setup>
import { ref, reactive, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
  Search,
  Refresh,
  Upload,
  VideoCamera,
  UploadFilled,
  Document,
  Delete,
  View,
  Download, Plus, Edit
} from '@element-plus/icons-vue'
import { useArticleStore } from '@/stores/article'
import {getArticleDetail} from "@/api/article.js";
import VideoConfigSelect from "@/components/VideoConfigSelect.vue";
import {useConfigStore} from "@/stores/video/config.js";
import {useTaskStore} from "@/stores/task.js";
import * as XLSX from 'xlsx';
import { getCategoryTree, addCategory } from '@/api/category'
import ArticleEditDialog from "@/components/ArticleEditDialog.vue";

const generatingVideo = ref(false)  // 全局loading状态
const submitting = ref(false)       // 提交按钮loading状态

const articleStore = useArticleStore()
const configStore = useConfigStore()
const taskStore = useTaskStore()

// 导入表单数据
const importForm = reactive({
  categoryId: null,
  file: null
})

// 生成视频相关数据
const generateDialog = reactive({
  form: {
    avatarId: '',
    voiceId: '',
    background: '#f6f6fc'
  },
  visible: false,
  resolution: '1080x1920',
  articles: [], // 存储要生成视频的文章
})

const editDialogVisible = ref(false)
const editingArticles = ref([])

const handleEdit = (articles) => {
  editingArticles.value = articles
  editDialogVisible.value = true
}

const handleEditSave = async () => {
  await getList()
}

const handleBatchEdit = () => {
  if (selectedArticles.value.length === 0) {
    ElMessage.warning('请选择要编辑的文章')
    return
  }
  // 过滤出可编辑的文章（状态不是"已完成"和"处理中"的文章）
  const editableArticles = selectedArticles.value.filter(
      article => article.status !== '已完成' && article.status !== '处理中'
  )

  // 检查是否有可编辑的文章
  if (editableArticles.length === 0) {
    ElMessage.warning('选中的文章都是已完成或处理中状态，无法编辑')
    return
  }

  // 如果有不可编辑的文章，给用户提示
  if (editableArticles.length < selectedArticles.value.length) {
    ElMessage.info(`已过滤掉 ${selectedArticles.value.length - editableArticles.length} 篇已完成或处理中的文章`)
  }

  handleEdit(editableArticles )
}

// 获取默认配置
const defaultConfig = ref(null)
const defaultLoading = ref(false)
const loadDefaultConfig = async () => {
  await configStore.getDefault()
  defaultConfig.value = configStore.defaultConfigs
}

// 处理生成视频
const handleGenerateVideo = () => {
  if (generatingVideo.value) {
    ElMessage.warning('有视频正在生成中，请稍候...')
    return
  }

  if (selectedArticles.value.length === 0) {
    ElMessage.warning('请选择要生成视频的文章')
    return
  }
  generateDialog.articles = selectedArticles.value
  generateDialog.visible = true
  defaultLoading.visible = true
}

// 处理单个生成
const handleGenerateSingle = (row) => {
  if (generatingVideo.value) {
    ElMessage.warning('有视频正在生成中，请稍候...')
    return
  }
  generateDialog.articles = [row]
  generateDialog.visible = true
}

// 处理配置确认
const handleGenerateConfirm = async (config) => {
  if (generatingVideo.value) return

  try {
    submitting.value = true
    generatingVideo.value = true

    let params = {
      articleIds: generateDialog.articles.map(item => item.id),
      mode: config.mode
    }

    if (config.mode === 'single') {
      // 单数字人模式
      params.config = {
        id: config.config.id,
        avatarId: config.config.avatarId,
        voiceId: config.config.voiceId,
        xOffset: config.config.xOffset,
        yOffset: config.config.yOffset,
        scale: config.config.scale,
        backgroundType: config.config.backgroundType,
        backgroundId: config.config.backgroundId,
        backgroundColor: config.config.backgroundColor,
        backgroundUrl: config.config.backgroundUrl,
        backgroundFit: config.config.backgroundFit,
        backgroundPlayStyle: config.config.backgroundPlayStyle,
        width: config.config.width,
        height: config.config.height,
        isDefault: config.config.isDefault,
        isCaption: config.config.isCaption,
      }
    } else {
      // 多数字人模式
      params.commonConfig = {
        backgroundType: config.commonConfig.backgroundType,
        backgroundId: config.commonConfig.backgroundId,
        backgroundUrl: config.commonConfig.backgroundUrl,
        backgroundUrls: config.commonConfig.backgroundUrls,
        backgroundIds: config.commonConfig.backgroundIds,
        backgroundColor: config.commonConfig.backgroundColor,
        backgroundFit: config.commonConfig.backgroundFit,
        backgroundPlayStyle: config.commonConfig.backgroundPlayStyle,
        width: config.commonConfig.width,
        height: config.commonConfig.height,
        isCaption: config.commonConfig.isCaption,
        one_to_one: config.commonConfig.one_to_one
      }

      // 处理数字人配置列表
      params.avatarConfigs = config.avatarConfigs.map(avatar => ({
        avatarId: avatar.avatarId,
        voiceId: avatar.voiceId,
        xOffset: avatar.xOffset,
        yOffset: avatar.yOffset,
        scale: avatar.scale,
        content: avatar.content
      }))
    }

    await taskStore.generateBatchAiVideos(params)
    generateDialog.visible = false
    await getList()
  } catch (error) {

  } finally {
    submitting.value = false
    generatingVideo.value = false
    generateDialog.visible = false
    generateDialog.articles = []
  }
}

const handleGenerateClose = () => {
  if (generatingVideo.value) {
    ElMessage.warning('视频正在生成中，请稍候...')
    return
  }
  generateDialog.visible = false
  generateDialog.articles = []
}

// 查询参数
const queryParams = reactive({
  pageNum: 1,
  pageSize: 10,
  categoryId: null,
  title: '',
  status: '',
})

// 文章详情弹窗数据
const detailDialog = reactive({
  visible: false,
  form: {
    title: '',
    description: '',
    url: '',
    status: ''
  }
})

// 查看文章详情
const handleView = async (row) => {
  try {
    const { data } = await getArticleDetail(row.id)
    detailDialog.form = data
    detailDialog.visible = true
  } catch (error) {
    ElMessage.error(error.message || '获取详情失败')
  }
}

// 删除单个文章
const handleDelete = (row) => {
  ElMessageBox.confirm('确定要删除该文章吗？', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(async () => {
    await articleStore.deleteArticle(row.id)
    await getList()
  })
}

// 批量删除
const handleBatchDelete = () => {
  if (selectedArticles.value.length === 0) {
    ElMessage.warning('请选择要删除的文章')
    return
  }

  // 筛选出可删除和不可删除的文章
  const deletableArticles = selectedArticles.value.filter(article => article.status === '未处理')
  const nonDeletableArticles = selectedArticles.value.filter(article => article.status !== '未处理')

  // 构建确认消息
  let confirmMessage = `确定要删除选中的 ${deletableArticles.length} 篇文章吗？`
  if (nonDeletableArticles.length > 0) {
    confirmMessage += `\n注意：其中 ${nonDeletableArticles.length} 篇已处理的文章将不会被删除。`
  }

  ElMessageBox.confirm(
      confirmMessage,
      '提示',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }
  ).then(async () => {
    const ids = selectedArticles.value.map(item => item.id)
    await articleStore.batchDelete(ids)
    await getList()
  }).catch(() => {
    // 用户点击取消，不做任何操作
  })
}

// 导入对话框数据
const importDialog = reactive({
  visible: false,
  loading: false,
  file: null
})

// 分类对话框数据
const categoryDialog = reactive({
  visible: false,
  isEdit: false,
  form: {
    parentId: null,
    name: '',
    code: '',
    sort: 0,
    description: ''
  }
})

// 分类表单校验规则
const categoryRules = {
  name: [
    { required: true, message: '请输入分类名称', trigger: 'blur' },
    { max: 50, message: '长度不能超过50个字符', trigger: 'blur' }
  ],
  code: [
    { required: true, message: '请输入分类编码', trigger: 'blur' },
    { pattern: /^[A-Z_]+$/, message: '只能包含大写字母和下划线', trigger: 'blur' }
  ]
}

// 分类选项
const categoryOptions = ref([])

// 加载分类数据
const loadCategories = async () => {
  try {
    const { data } = await getCategoryTree('article')
    categoryOptions.value = data
  } catch (error) {
    ElMessage.error('获取分类失败')
  }
}

// 显示添加分类对话框
const showCategoryDialog = () => {
  categoryDialog.visible = true
  categoryDialog.isEdit = false
  categoryDialog.form = {
    parentId: null,
    name: '',
    code: '',
    sort: 0,
    description: ''
  }
}

// 提交分类
const submitCategory = async () => {
  try {
    await addCategory({
      ...categoryDialog.form,
      type: 'article'
    })
    ElMessage.success('添加成功')
    categoryDialog.visible = false
    await loadCategories()
  } catch (error) {
    ElMessage.error('添加失败')
  }
}

// 文件改变处理
const handleFileChange = (file) => {
  const validTypes = [
    'application/vnd.ms-excel',
    'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  ]
  if (!validTypes.includes(file.raw.type)) {
    ElMessage.error('只能上传Excel文件！')
    return
  }
  importDialog.file = file.raw
}

// 下载导入模板
const downloadTemplate = () => {
  // 创建工作簿
  const workbook = XLSX.utils.book_new()

  // 创建工作表数据
  const data = [
    ['标题', '描述'], // 表头
    ['文章标题示例', '文章描述示例'] // 示例数据
  ]

  // 创建工作表
  const worksheet = XLSX.utils.aoa_to_sheet(data)

  // 将工作表添加到工作簿
  XLSX.utils.book_append_sheet(workbook, worksheet, '文章导入模板')

  // 下载文件
  XLSX.writeFile(workbook, '文章导入模板.xlsx')
}

// 移除文件
const handleRemoveFile = () => {
  importDialog.file = null
}

// 提交导入
const submitImport = async () => {
  if (!importForm.categoryId) {
    ElMessage.warning('请选择分类')
    return
  }

  if (!importDialog.file) {
    ElMessage.warning('请选择要导入的文件')
    return
  }

  const formData = new FormData()
  formData.append('file', importDialog.file)
  formData.append('categoryId', importForm.categoryId)
  try {
    importDialog.loading = true
    await articleStore.importArticleData(formData)
    importDialog.visible = false
  } catch (error) {

  } finally {
    await getList()
    importDialog.loading = false
    importDialog.file = null
    importForm.categoryId = null
  }
}

// 表格数据
const loading = ref(false)
const articleList = ref([])
const total = ref(0)
const selectedArticles = ref([])

// 获取文章列表
const getList = async () => {
  if (generatingVideo.value) return

  loading.value = true
  try {
    await articleStore.fetchArticles(queryParams);
    articleList.value = articleStore.articles
    total.value = articleStore.total
  } finally {
    loading.value = false
  }
}

// 查询
const handleQuery = () => {
  queryParams.pageNum = 1
  getList()
}

// 重置
const resetQuery = () => {
  queryParams.batchId = ''
  queryParams.title = ''
  queryParams.status = ''
  queryParams.categoryId = null
  handleQuery()
}

// 导入相关方法
const handleImport = () => {
  importDialog.visible = true
}

// 表格选择
const handleSelectionChange = (selection) => {
  selectedArticles.value = selection
}

const getVideoStatusType = (status) => {
  const types = {
    '未处理': 'info',
    '处理中': 'warning',
    '已完成': 'success',
    '生成失败': 'danger'
  }
  return types[status] || 'info'
}

// 判断是否可以生成视频
const canGenerate = (row) => {
  return row.status === '未处理' || row.status === '失败'
}

// 分页方法
const handleSizeChange = (val) => {
  queryParams.pageSize = val
  getList()
}

const handleCurrentChange = (val) => {
  queryParams.pageNum = val
  getList()
}

// 初始化
onMounted(async () => {
  await Promise.all([
    getList(),
    loadDefaultConfig(),
    loadCategories()
  ])
})
</script>

<style scoped>
.article-container {
  position: relative;
  min-height: 200px;  /* 给一个最小高度以显示loading */
}

.search-card {
  margin-bottom: 20px;
}

.import-form {
  margin-bottom: 20px;
}

.category-select {
  width: 260px;
}

.add-category-btn {
  margin-left: 10px;
}

.import-header {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--el-border-color-lighter);
}

.upload-container {
  padding: 20px 0;
}

.file-info {
  margin-top: 20px;
  padding: 10px;
  background-color: var(--el-fill-color-light);
  border-radius: 4px;
}

.file-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialog-footer {
  text-align: right;
}

.import-header {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--el-border-color-lighter);
}

.upload-container {
  padding: 20px 0;
}

.upload-drop {
  display: flex;
  justify-content: center;
}

.file-info {
  margin-top: 20px;
  padding: 10px;
  background-color: var(--el-fill-color-light);
  border-radius: 4px;
}

.file-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.left, .right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.el-button-group {
  display: flex;
  gap: 8px;
}

/* 增加表格行的悬停效果 */
:deep(.el-table__row) {
  transition: background-color 0.3s;
}

:deep(.el-table__row:hover) {
  background-color: var(--el-fill-color-light);
}

/* 美化弹窗样式 */
.el-descriptions {
  padding: 20px;
}

.dialog-footer {
  padding-top: 20px;
  border-top: 1px solid var(--el-border-color-lighter);
}

.upload-container {
  padding: 20px 0;
}

.upload-drop {
  display: flex;
  justify-content: center;
}

.file-info {
  margin-top: 20px;
  padding: 10px;
  background-color: #f5f7fa;
  border-radius: 4px;
}

.file-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-name .el-icon {
  color: #909399;
}

.article-container {
  padding: 20px;
}

.search-card {
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
}

.pagination {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.dialog-footer {
  text-align: right;
}
</style>